package model;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "ChiTietHoaDon_Sach")
public class ChiTietHoaDon_Sach {
	private ChiTietHoaDon_SachID chiTietHoaDon_SachID;
	private Sach sach;
	private HoaDon hoaDon;
	private String tenSach;
	private int soLuongSach;
	private float tongGiaSach;
	private float tongTien;
//	private int id_HoaDon;

//	public ChiTietHoaDon_Sach(ChiTietHoaDon_SachID chiTietHoaDon_SachID,
//			Sach sach, HoaDon hoaDon, int soLuongSach, float giamGia, double tongSoLuong_Gia) {
//		super();
//		this.chiTietHoaDon_SachID = chiTietHoaDon_SachID;
//		this.sach = sach;
//		this.hoaDon = hoaDon;
//		this.soLuongSach = soLuongSach;
//		this.giamGia = giamGia;
//		this.tongSoLuong_Gia = tongSoLuong_Gia;
//	}

	public ChiTietHoaDon_Sach() {

	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "ID_Sach", column = @Column(name = "ID_Sach", nullable = false)),
			@AttributeOverride(name = "ID_HoaDon", column = @Column(name = "ID_HoaDon", nullable = false)) })
	public ChiTietHoaDon_SachID getChiTietHoaDon_SachID() {
		return chiTietHoaDon_SachID;
	}

	public void setChiTietHoaDon_SachID(
			ChiTietHoaDon_SachID chiTietHoaDon_SachID) {
		this.chiTietHoaDon_SachID = chiTietHoaDon_SachID;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_Sach", nullable = false, insertable = false, updatable = false)
	public Sach getSach() {
		return sach;
	}

	public void setSach(Sach sach) {
		this.sach = sach;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_HoaDon", nullable = false, insertable = false, updatable = false)
	public HoaDon getHoaDon() {
		return hoaDon;
	}

	public void setHoaDon(HoaDon hoaDon) {
		this.hoaDon = hoaDon;
	}
	
	@Column(name = "TenSach")
	public String getTenSach() {
		return tenSach;
	}
	
	public void setTenSach(String tenSach) {
		this.tenSach = tenSach;
	}

	@Column(name = "SoLuongSach")
	public int getSoLuongSach() {
		return soLuongSach;
	}

	public void setSoLuongSach(int soLuongSach) {
		this.soLuongSach = soLuongSach;
	}


	@Column(name = "TongTien")
	public float getTongTien() {
		return tongTien;
	}

	public void setTongTien(float tongTien) {
		this.tongTien = tongTien;
	}

//	@Column(name = "ID_HoaDon")
//	public int getId_HoaDon() {
//		return id_HoaDon;
//	}
//
//	public void setId_HoaDon(int id_HoaDon) {
//		this.id_HoaDon = id_HoaDon;
//	}

	@Column(name = "TongGiaSach")
	public float getTongGiaSach() {
		return tongGiaSach;
	}

	public void setTongGiaSach(float tongGiaSach) {
		this.tongGiaSach = tongGiaSach;
	}
	
//	@Column(name = "GiamGia")
//	public float getGiamGia() {
//		return giamGia;
//	}
//
//	public void setGiamGia(float giamGia) {
//		this.giamGia = giamGia;
//	}
//
//	@Column(name = "TongSoLuong_Gia", nullable = false)
//	public double getTongSoLuong_Gia() {
//		return tongSoLuong_Gia;
//	}
//
//	public void setTongSoLuong_Gia(double tongSoLuong_Gia) {
//		this.tongSoLuong_Gia = tongSoLuong_Gia;
//	}
	
	
	

}
